﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WXYW
{
    public partial class AdminLeft : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                TreeNode tNode = new TreeNode("流程管理");
                tNode.SelectAction = TreeNodeSelectAction.Expand;
                TreeNode tNode1 = new TreeNode("所有客户申请单");
                tNode1.SelectAction = TreeNodeSelectAction.Expand;
                TreeNode tNode2 = new TreeNode("所有原始申请单", "", "", "AllApplication.aspx", "mainFrame");
                TreeNode tNode3 = new TreeNode("所有处理申请单", "", "", "AllOnProcessApplication.aspx", "mainFrame");
                tNode1.ChildNodes.Add(tNode2);
                tNode1.ChildNodes.Add(tNode3);
                tNode.ChildNodes.Add(tNode1);
                tNode.Expanded = true;
                menuTreeView.Nodes.Add(tNode);
                if (ContextService.HasSubPermission(1) > 0)
                {
                    if (ContextService.GetPermission(112) > 0)
                    {
                        tNode1 = new TreeNode("申请单代填", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        tNode2 = new TreeNode("申请单填写", "", "", "FillRMAByAgent.aspx?Insert=1", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(3) > 0)
                    {
                        tNode1 = new TreeNode("单号分配", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        tNode2 = new TreeNode("待确认申请单", "", "", "ListRMAForm.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(4) > 0)
                    {
                        tNode1 = new TreeNode("收货确认", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        tNode2 = new TreeNode("收货待确认", "", "", "ListNeedConfirmProduct.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(5) > 0)
                    {
                        tNode1 = new TreeNode("派单", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        tNode2 = new TreeNode("派单", "", "", "ListFormNeedToDistribute.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(6) > 0 ||
                        ContextService.GetPermission(7) > 0)
                    {
                        tNode1 = new TreeNode("维修以及报价", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(6) > 0)
                        {
                            tNode2 = new TreeNode("RMA/DOA维修", "", "", "ListFormNeedRepair.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(7) > 0)
                        {
                            tNode2 = new TreeNode("RMA/DOA维修预警", "", "", "ListRepairFormOverDue.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(8) > 0)
                    {
                        tNode1 = new TreeNode("待确认报价是否维修", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        tNode2 = new TreeNode("待确认报价是否维修", "", "", "ListFormConfirmQuatation.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(9) > 0 ||
                        ContextService.GetPermission(10) > 0 || ContextService.GetPermission(114) > 0)
                    {
                        tNode1 = new TreeNode("财务收款确认", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(9) > 0)
                        {
                            tNode2 = new TreeNode("财务收款确认", "", "", "ListConfirmGathering.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(10) > 0)
                        {
                            tNode2 = new TreeNode("发票速递确认", "", "", "ReceiptExpressDeliveryConfirm.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(114) > 0)
                        {
                            tNode2 = new TreeNode("发票速递记录", "", "", "ListKPHistory.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(11) > 0 ||
                        ContextService.GetPermission(12) > 0)
                    {
                        tNode1 = new TreeNode("维修完毕待发货", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(11) > 0)
                        {
                            tNode2 = new TreeNode("维修完毕待发货", "", "", "FinishMaintaince.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(12) > 0)
                        {
                            tNode2 = new TreeNode("待用户收货确认", "", "", "ListApplicationFormNeedClientConfirm.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(106) > 0)
                        {
                            tNode2 = new TreeNode("客户收货日期确认", "", "", "ListProductHaveSent.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(13) > 0)
                    {
                        tNode1 = new TreeNode("客户满意度评价", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        tNode2 = new TreeNode("客户满意度评价", "", "", "ConfirmClientComment.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);

                        tNode2 = new TreeNode("客户回访记录", "", "", "CustomerFeedbackfList.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);

                        tNode.ChildNodes.Add(tNode1);
                    }
                }

                if (ContextService.HasSubPermission(2) > 0)
                {
                    tNode1 = new TreeNode("升级管理", "", "", "", "");
                    tNode1.SelectAction = TreeNodeSelectAction.Expand;
                    tNode1.Expanded = false;
                    if (ContextService.GetPermission(14) > 0)
                    {
                        tNode2 = new TreeNode("我的升级申请单", "", "", "AllUpgradeForms.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    if (ContextService.GetPermission(15) > 0)
                    {
                        tNode2 = new TreeNode("升级维修审批", "", "", "UpgradeNeedApprove.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    if (ContextService.GetPermission(16) > 0)
                    {
                        tNode2 = new TreeNode("升级维修平台发货", "", "", "UpgradeNeedSendProduct.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    if (ContextService.GetPermission(17) > 0)
                    {
                        tNode2 = new TreeNode("升级维修收货确认", "", "", "UpgradeNeedConfirmProduct.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    if (ContextService.GetPermission(18) > 0)
                    {
                        tNode2 = new TreeNode("升级维修派单", "", "", "UpgradeNeedDistributeProduct.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }

                    if (ContextService.GetPermission(82) > 0)
                    {
                        tNode2 = new TreeNode("升级维修完毕待发货", "", "", "UpgradeNeedSendBack.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }

                    if (ContextService.GetPermission(19) > 0)
                    {
                        tNode2 = new TreeNode("平台收货确认", "", "", "UpgradeListServiceStationNeedConfirm.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    menuTreeView.Nodes.Add(tNode1);
                }

                if (ContextService.HasSubPermission(3) > 0)
                {
                    tNode1 = new TreeNode("备件先行申请管理", "", "", "", "");
                    tNode1.SelectAction = TreeNodeSelectAction.Expand;
                    tNode1.Expanded = false;
                    if (ContextService.GetPermission(20) > 0)
                    {
                        tNode2 = new TreeNode("所有原始备件先行单", "", "", "BJXXApplicationHistory.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    if (ContextService.GetPermission(21) > 0)
                    {
                        tNode2 = new TreeNode("所有处理备件先行单", "", "", "BJXXAllOnProcess.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    if (ContextService.GetPermission(105) > 0)
                    {
                        tNode2 = new TreeNode("备件先行申请单填写", "", "", "BJXXFillApplication.aspx?Insert=1", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    if (ContextService.GetPermission(22) > 0)
                    {
                        tNode2 = new TreeNode("已提交待审批", "", "", "BJXXListNeedApprove.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    if (ContextService.GetPermission(23) > 0)
                    {
                        tNode2 = new TreeNode("未批准备件先行单", "", "", "BJXXListDisagreeForms.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    if (ContextService.GetPermission(24) > 0)
                    {
                        tNode2 = new TreeNode("备件先行已审批待发货", "", "", "BJXXListNeedSend.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }

                    if (ContextService.GetPermission(117) > 0)
                    {
                        tNode2 = new TreeNode("已发货待客户收货", "", "", "BJXXListConfirmClientReceived.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }

                    if (ContextService.GetPermission(25) > 0)
                    {
                        tNode2 = new TreeNode("待备件先行收回确认", "", "", "BJXXListNeedConfirmReturn.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }

                    if (ContextService.GetPermission(111) > 0)
                    {
                        tNode2 = new TreeNode("备件派单", "", "", "BJXXListNeedDistribute.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }


                    if (ContextService.GetPermission(107) > 0)
                    {
                        tNode2 = new TreeNode("待验证备件先行单", "", "", "BJXXListNeedCheck.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }

                    if (ContextService.GetPermission(108) > 0)
                    {
                        tNode2 = new TreeNode("技术支持验证结果", "", "", "BJXXListSupportCheck.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    menuTreeView.Nodes.Add(tNode1);
                }

                if (ContextService.HasSubPermission(4) > 0)
                {
                    tNode1 = new TreeNode("备件申请管理", "", "", "", "");
                    tNode1.SelectAction = TreeNodeSelectAction.Expand;
                    tNode1.Expanded = false;
                    if (ContextService.GetPermission(26) > 0)
                    {
                        tNode2 = new TreeNode("我的备件申请表单", "", "", "AllSparePartApplyForms.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    if (ContextService.GetPermission(27) > 0)
                    {
                        tNode2 = new TreeNode("待审批备件", "", "", "SparePartApplyListNeedApprove.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    if (ContextService.GetPermission(28) > 0)
                    {
                        tNode2 = new TreeNode("已审批待发货", "", "", "SpartPartApplyListSend.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    if (ContextService.GetPermission(29) > 0)
                    {
                        tNode2 = new TreeNode("平台收货确认", "", "", "SparePartApplyListConfirmReceive.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    if (ContextService.GetPermission(30) > 0)
                    {
                        tNode2 = new TreeNode("平台备件返还", "", "", "SparePartApplyListNeedReturn.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }

                    if (ContextService.GetPermission(31) > 0)
                    {
                        tNode2 = new TreeNode("备件提供方收货确认", "", "", "SparePartApplyListConfirmReturn.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    menuTreeView.Nodes.Add(tNode1);
                }

                if (ContextService.HasSubPermission(5) > 0)
                {
                    tNode1 = new TreeNode("返厂申请管理", "", "", "", "");
                    tNode1.SelectAction = TreeNodeSelectAction.Expand;
                    tNode1.Expanded = false;
                    if (ContextService.GetPermission(99) > 0)
                    {
                        tNode2 = new TreeNode("所有返厂申请单", "", "", "AllReturnToFactoryList.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }

                    if (ContextService.GetPermission(59) > 0)
                    {
                        tNode2 = new TreeNode("返厂待确认厂商", "", "", "ReturnToFactoryListConfirmProvider.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }

                    if (ContextService.GetPermission(32) > 0)
                    {
                        tNode2 = new TreeNode("返厂RMA#确认", "", "", "AllReturnToFactoryApplication.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }

                    if (ContextService.GetPermission(33) > 0)
                    {
                        tNode2 = new TreeNode("返厂发货", "", "", "ReturnToFactoryListNeedSend.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    if (ContextService.GetPermission(34) > 0)
                    {
                        tNode2 = new TreeNode("工厂收货", "", "", "ReturnToFactoryListConfirmFactoryReceive.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    if (ContextService.GetPermission(35) > 0)
                    {
                        tNode2 = new TreeNode("返厂维修与报价", "", "", "ReturnToFactoryNeedMaintain.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }

                    //if (ContextService.GetPermission(83) > 0)
                    //{
                    //    tNode2 = new TreeNode("返厂报价-客户", "", "", "ReturnToFactoryListFormNeedQuatationToClient.aspx", "mainFrame");
                    //    tNode1.ChildNodes.Add(tNode2);
                    //}

                    if (ContextService.GetPermission(36) > 0)
                    {

                        tNode2 = new TreeNode("返厂报价确认", "", "", "ReturnToFactoryListConfirmQuotation.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }

                    if (ContextService.GetPermission(37) > 0)
                    {
                        tNode2 = new TreeNode("返厂收货确认", "", "", "ReturnToFactoryListConfirmReceive.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }

                    //if (ContextService.GetPermission(98) > 0)
                    //{
                    //    tNode2 = new TreeNode("返厂待验证", "", "", "ReturnToFactoryCheckList.aspx", "mainFrame");
                    //    tNode1.ChildNodes.Add(tNode2);
                    //}
                    menuTreeView.Nodes.Add(tNode1);
                }

                if (ContextService.HasSubPermission(6) > 0)
                {
                    tNode = new TreeNode("后台数据维护", "", "", "", "");
                    tNode.SelectAction = TreeNodeSelectAction.Expand;
                    tNode.Expanded = false;
                    menuTreeView.Nodes.Add(tNode);

                    if (ContextService.GetPermission(38) > 0 ||
                       ContextService.GetPermission(39) > 0 ||
                       ContextService.GetPermission(40) > 0)
                    {
                        tNode1 = new TreeNode("客户管理", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(38) > 0)
                        {
                            tNode2 = new TreeNode("新增客户资料", "", "", "AddUser.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(39) > 0)
                        {
                            tNode2 = new TreeNode("管理客户资料", "", "", "ManagerCustomer.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(40) > 0)
                        {
                            tNode2 = new TreeNode("查询客户资料", "", "", "SearchUser.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(41) > 0 ||
                        ContextService.GetPermission(42) > 0 ||
                        ContextService.GetPermission(43) > 0 ||
                        ContextService.GetPermission(44) > 0)
                    {
                        tNode1 = new TreeNode("备件管理", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(41) > 0)
                        {
                            tNode2 = new TreeNode("新增备件", "", "", "AddSparePart.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(42) > 0)
                        {
                            tNode2 = new TreeNode("备件管理", "", "", "ManageSparePart.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(43) > 0)
                        {
                            tNode2 = new TreeNode("备件查询", "", "", "SearchSparePart.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(44) > 0)
                        {
                            tNode2 = new TreeNode("平台管理", "", "", "", "");
                            tNode2.SelectAction = TreeNodeSelectAction.Expand;
                            tNode3 = new TreeNode("备件管理", "", "", "ManageSparePartPlatform.aspx", "mainFrame");
                            tNode2.ChildNodes.Add(tNode3);
                            tNode3 = new TreeNode("借用记录", "", "", "SparePartLendRecord.aspx", "mainFrame");
                            tNode2.ChildNodes.Add(tNode3);
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(45) > 0 ||
                        ContextService.GetPermission(46) > 0 ||
                        ContextService.GetPermission(47) > 0 ||
                        ContextService.GetPermission(48) > 0 ||
                        ContextService.GetPermission(49) > 0)
                    {
                        tNode1 = new TreeNode("元器件管理", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(45) > 0)
                        {
                            tNode2 = new TreeNode("新增元器件", "", "", "AddAccessory.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(46) > 0)
                        {
                            tNode2 = new TreeNode("元器件管理", "", "", "ManageComponent.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(47) > 0)
                        {
                            tNode2 = new TreeNode("元器件查询", "", "", "ComponentQuery.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(48) > 0)
                        {
                            tNode2 = new TreeNode("价格管理", "", "", "ManageComponentPrice.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(49) > 0)
                        {
                            tNode2 = new TreeNode("平台管理", "", "", "ManageComponentOfPlatform.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(50) > 0 ||
                       ContextService.GetPermission(51) > 0 ||
                       ContextService.GetPermission(52) > 0)
                    {
                        tNode1 = new TreeNode("代理商管理", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(50) > 0)
                        {
                            tNode2 = new TreeNode("新增代理商资料", "", "", "AddProvider.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(51) > 0)
                        {
                            tNode2 = new TreeNode("管理代理商资料", "", "", "ManageProvider.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(52) > 0)
                        {
                            tNode2 = new TreeNode("查询代理商资料", "", "", "SearchProvider.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(71) > 0 ||
                        ContextService.GetPermission(72) > 0)
                    {
                        tNode1 = new TreeNode("产品类型管理", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(71) > 0)
                        {
                            tNode2 = new TreeNode("新增产品类型", "", "", "AddProductClass.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(72) > 0)
                        {
                            tNode2 = new TreeNode("管理产品类型", "", "", "ManageProductClass.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(109) > 0 ||
                       ContextService.GetPermission(110) > 0)
                    {
                        tNode1 = new TreeNode("产品型号管理", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(109) > 0)
                        {
                            tNode2 = new TreeNode("新增产品型号", "", "", "AddProductType.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(110) > 0)
                        {
                            tNode2 = new TreeNode("管理产品型号", "", "", "ManageProductType.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(53) > 0 ||
                       ContextService.GetPermission(54) > 0 ||
                       ContextService.GetPermission(55) > 0)
                    {
                        tNode1 = new TreeNode("产品信息管理", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(53) > 0)
                        {
                            tNode2 = new TreeNode("新增产品信息", "", "", "AddProduct.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(54) > 0)
                        {
                            tNode2 = new TreeNode("管理产品信息", "", "", "ManageProduct.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(55) > 0)
                        {
                            tNode2 = new TreeNode("查看产品信息", "", "", "SearchProduct.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);

                            tNode2 = new TreeNode("Barcoard 查询", "", "", "Barcoard.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(56) > 0 ||
                       ContextService.GetPermission(57) > 0 ||
                       ContextService.GetPermission(58) > 0)
                    {
                        tNode1 = new TreeNode("物流管理", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(56) > 0)
                        {
                            tNode2 = new TreeNode("新建物流公司", "", "", "AddLogisticCompany.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(57) > 0)
                        {
                            tNode2 = new TreeNode("物流信息管理", "", "", "ManageLogisticCompany.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(58) > 0)
                        {
                            tNode2 = new TreeNode("物流信息查询", "", "", "SearchLogisticCompany.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(73) > 0 ||
                        ContextService.GetPermission(74) > 0 ||
                        ContextService.GetPermission(75) > 0 ||
                        ContextService.GetPermission(76) > 0)
                    {
                        tNode1 = new TreeNode("任务处理", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(73) > 0)
                        {
                            tNode2 = new TreeNode("建立新任务", "", "", "RWGLNewTask.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(74) > 0)
                        {
                            tNode2 = new TreeNode("待处理任务", "", "", "RWGLTasksNeedDealWith.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(75) > 0)
                        {
                            tNode2 = new TreeNode("已完成任务", "", "", "RTGLCompleteTeaks.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(76) > 0)
                        {
                            tNode2 = new TreeNode("任务管理", "", "", "RWGL.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(116) > 0)
                        {
                            tNode2 = new TreeNode("任务查询", "", "", "RWGLSearch.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(77) > 0 ||
                       ContextService.GetPermission(78) > 0)
                    {
                        tNode1 = new TreeNode("资料/故障管理", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(115) > 0)
                        {
                            tNode2 = new TreeNode("添加资料/故障", "", "", "ProblemReportNew.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(77) > 0)
                        {
                            tNode2 = new TreeNode("管理资料/故障", "", "", "ProblemReportManage.aspx?T=0&P=0", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);

                            tNode3 = new TreeNode("安装调试", "", "", "ProblemReportManage.aspx?T=安装调试&P=0", "mainFrame");
                            tNode2.ChildNodes.Add(tNode3);

                            TreeNode tNode4 = new TreeNode("交换机", "", "", "ProblemReportManage.aspx?T=安装调试&P=交换机", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("网络安全", "", "", "ProblemReportManage.aspx?T=安装调试&P=网络安全", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("应用交付", "", "", "ProblemReportManage.aspx?T=安装调试&P=应用交付", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("路由器", "", "", "ProblemReportManage.aspx?T=安装调试&P=路由器", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("语音", "", "", "ProblemReportManage.aspx?T=安装调试&P=语音", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("无线", "", "", "ProblemReportManage.aspx?T=安装调试&P=无线", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("存储和其他", "", "", "ProblemReportManage.aspx?T=安装调试&P=存储和其他", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode3 = new TreeNode("故障排除", "", "", "ProblemReportManage.aspx?T=故障排除&P=0", "mainFrame");
                            tNode2.ChildNodes.Add(tNode3);

                            tNode4 = new TreeNode("交换机", "", "", "ProblemReportManage.aspx?T=故障排除&P=交换机", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("网络安全", "", "", "ProblemReportManage.aspx?T=故障排除&P=网络安全", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("应用交付", "", "", "ProblemReportManage.aspx?T=故障排除&P=应用交付", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("路由器", "", "", "ProblemReportManage.aspx?T=故障排除&P=路由器", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("语音", "", "", "ProblemReportManage.aspx?T=故障排除&P=语音", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("无线", "", "", "ProblemReportManage.aspx?T=故障排除&P=无线", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("存储和其他", "", "", "ProblemReportManage.aspx?T=故障排除&P=存储和其他", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode3 = new TreeNode("通用资料", "", "", "ProblemReportManage.aspx?T=通用资料&P=0", "mainFrame");
                            tNode2.ChildNodes.Add(tNode3);

                            tNode4 = new TreeNode("交换机", "", "", "ProblemReportManage.aspx?T=通用资料&P=交换机", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("网络安全", "", "", "ProblemReportManage.aspx?T=通用资料&P=网络安全", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("应用交付", "", "", "ProblemReportManage.aspx?T=通用资料&P=应用交付", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("路由器", "", "", "ProblemReportManage.aspx?T=通用资料&P=路由器", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("语音", "", "", "ProblemReportManage.aspx?T=通用资料&P=语音", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("无线", "", "", "ProblemReportManage.aspx?T=通用资料&P=无线", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("存储和其他", "", "", "ProblemReportManage.aspx?T=通用资料&P=存储和其他", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode3 = new TreeNode("维修资料", "", "", "ProblemReportManage.aspx?T=维修资料&P=0", "mainFrame");
                            tNode2.ChildNodes.Add(tNode3);

                            tNode4 = new TreeNode("交换机", "", "", "ProblemReportManage.aspx?T=维修资料&P=交换机", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("网络安全", "", "", "ProblemReportManage.aspx?T=维修资料&P=网络安全", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("应用交付", "", "", "ProblemReportManage.aspx?T=维修资料&P=应用交付", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("路由器", "", "", "ProblemReportManage.aspx?T=维修资料&P=路由器", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("语音", "", "", "ProblemReportManage.aspx?T=维修资料&P=语音", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("无线", "", "", "ProblemReportManage.aspx?T=维修资料&P=无线", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("存储和其他", "", "", "ProblemReportManage.aspx?T=维修资料&P=存储和其他", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);
                        }
                        if (ContextService.GetPermission(78) > 0)
                        {
                            tNode2 = new TreeNode("查看资料报告", "", "", "ProblemReportSearch.aspx?T=0&P=0", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);

                            tNode3 = new TreeNode("安装调试", "", "", "ProblemReportSearch.aspx?T=安装调试&P=0", "mainFrame");
                            tNode2.ChildNodes.Add(tNode3);

                            TreeNode tNode4 = new TreeNode("交换机", "", "", "ProblemReportSearch.aspx?T=安装调试&P=交换机", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("网络安全", "", "", "ProblemReportSearch.aspx?T=安装调试&P=网络安全", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("应用交付", "", "", "ProblemReportSearch.aspx?T=安装调试&P=应用交付", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("路由器", "", "", "ProblemReportSearch.aspx?T=安装调试&P=路由器", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("语音", "", "", "ProblemReportSearch.aspx?T=安装调试&P=语音", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("无线", "", "", "ProblemReportSearch.aspx?T=安装调试&P=无线", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("存储和其他", "", "", "ProblemReportSearch.aspx?T=安装调试&P=存储和其他", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode3 = new TreeNode("故障排除", "", "", "ProblemReportSearch.aspx?T=故障排除&P=0", "mainFrame");
                            tNode2.ChildNodes.Add(tNode3);

                            tNode4 = new TreeNode("交换机", "", "", "ProblemReportSearch.aspx?T=故障排除&P=交换机", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("网络安全", "", "", "ProblemReportSearch.aspx?T=故障排除&P=网络安全", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("应用交付", "", "", "ProblemReportSearch.aspx?T=故障排除&P=应用交付", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("路由器", "", "", "ProblemReportSearch.aspx?T=故障排除&P=路由器", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("语音", "", "", "ProblemReportSearch.aspx?T=故障排除&P=语音", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("无线", "", "", "ProblemReportSearch.aspx?T=故障排除&P=无线", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("存储和其他", "", "", "ProblemReportSearch.aspx?T=故障排除&P=存储和其他", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode3 = new TreeNode("通用资料", "", "", "ProblemReportSearch.aspx?T=通用资料&P=0", "mainFrame");
                            tNode2.ChildNodes.Add(tNode3);

                            tNode4 = new TreeNode("交换机", "", "", "ProblemReportSearch.aspx?T=通用资料&P=交换机", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("网络安全", "", "", "ProblemReportSearch.aspx?T=通用资料&P=网络安全", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("应用交付", "", "", "ProblemReportSearch.aspx?T=通用资料&P=应用交付", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("路由器", "", "", "ProblemReportSearch.aspx?T=通用资料&P=路由器", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("语音", "", "", "ProblemReportSearch.aspx?T=通用资料&P=语音", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("无线", "", "", "ProblemReportSearch.aspx?T=通用资料&P=无线", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("存储和其他", "", "", "ProblemReportSearch.aspx?T=通用资料&P=存储和其他", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode3 = new TreeNode("维修资料", "", "", "ProblemReportSearch.aspx?T=维修资料&P=0", "mainFrame");
                            tNode2.ChildNodes.Add(tNode3);

                            tNode4 = new TreeNode("交换机", "", "", "ProblemReportSearch.aspx?T=维修资料&P=交换机", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("网络安全", "", "", "ProblemReportSearch.aspx?T=维修资料&P=网络安全", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("应用交付", "", "", "ProblemReportSearch.aspx?T=维修资料&P=应用交付", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("路由器", "", "", "ProblemReportSearch.aspx?T=维修资料&P=路由器", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("语音", "", "", "ProblemReportSearch.aspx?T=维修资料&P=语音", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("无线", "", "", "ProblemReportSearch.aspx?T=维修资料&P=无线", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);

                            tNode4 = new TreeNode("存储和其他", "", "", "ProblemReportSearch.aspx?T=维修资料&P=存储和其他", "mainFrame");
                            tNode3.ChildNodes.Add(tNode4);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(79) > 0 ||
                       ContextService.GetPermission(80) > 0 ||
                       ContextService.GetPermission(81) > 0)
                    {
                        tNode1 = new TreeNode("客户公告管理", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(79) > 0)
                        {
                            tNode2 = new TreeNode("发布公告", "", "", "PublishPost.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(80) > 0)
                        {
                            tNode2 = new TreeNode("公告管理", "", "", "ManagePost.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(81) > 0)
                        {
                            tNode2 = new TreeNode("公告查询", "", "", "SearchPost.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    // 下拉菜单维护项，未考虑权限
                    tNode1 = new TreeNode("下拉菜单项维护", "", "", "", "");
                    tNode1.SelectAction = TreeNodeSelectAction.Expand;
                    if (true)
                    {
                        tNode2 = new TreeNode("故障类型", "", "", "ManageProblemType.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    if (true)
                    {
                        tNode2 = new TreeNode("收费原因", "", "", "ManageChargeReason.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    if (true)
                    {
                        tNode2 = new TreeNode("开票类型", "", "", "ManageReceiptType.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                    }
                    tNode.ChildNodes.Add(tNode1);
                }

                if (ContextService.HasSubPermission(7) > 0)
                {
                    tNode = new TreeNode("统计信息", "", "", "", "");
                    tNode.Expanded = false;
                    tNode.SelectAction = TreeNodeSelectAction.Expand;
                    menuTreeView.Nodes.Add(tNode);

                    if (ContextService.GetPermission(60) > 0)
                    {
                        tNode1 = new TreeNode("所有维修记录", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(60) > 0)
                        {
                            tNode2 = new TreeNode("所有维修记录", "", "", "AllMaintainRecords.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(60) > 0)
                        {
                            tNode2 = new TreeNode("所有返厂维修记录", "", "", "AllReturnToFactoryRecords.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(60) > 0)
                        {
                            tNode2 = new TreeNode("所有升级维修记录", "", "", "AllUpgrateRecords.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(60) > 0)
                        {
                            tNode2 = new TreeNode("所有备件申请记录", "", "", "AllSparePartApplyRecords.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(60) > 0)
                        {
                            tNode2 = new TreeNode("所有库存清理记录", "", "", "AllSRMaintainRecords.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode2 = new TreeNode("按RMA单号查询图片", "", "", "SearchProductPictures.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);

                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(61) > 0)
                    {
                        tNode1 = new TreeNode("分类维修记录", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(61) > 0)
                        {
                            tNode2 = new TreeNode("按客户名称", "", "", "AccordingToClientRecords.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(61) > 0)
                        {
                            tNode2 = new TreeNode("按申请单号", "", "", "AccordingToAppCodeRecords.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(61) > 0)
                        {
                            tNode2 = new TreeNode("按产品型号", "", "", "AccordingToProductTypeRecords.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(61) > 0)
                        {
                            tNode2 = new TreeNode("按产品故障类型", "", "", "AccordingToProblemType.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(62) > 0)
                    {
                        tNode1 = new TreeNode("全维修周期", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(62) > 0)
                        {
                            tNode2 = new TreeNode("每月按平台按服务人员", "", "", "", "mainFrame");
                            tNode2.SelectAction = TreeNodeSelectAction.Expand;
                            tNode3 = new TreeNode("总体周期统计", "", "", "QWXZQBaseOnMonthServiceStationAndServicePerson.aspx", "mainFrame");
                            tNode2.ChildNodes.Add(tNode3);
                            tNode3 = new TreeNode("选择统计", "", "", "QWXZQSearch.aspx", "mainFrame");
                            tNode2.ChildNodes.Add(tNode3);
                            tNode3 = new TreeNode("详细统计", "", "", "QWXZQDetail.aspx", "mainFrame");
                            tNode2.ChildNodes.Add(tNode3);
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(62) > 0)
                        {
                            tNode2 = new TreeNode("每月按自研和非自研", "", "", "QWXZQBaseonProductProperty.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(62) > 0)
                        {
                            tNode2 = new TreeNode("每月按保内和保外", "", "", "QWXZQBaseOnRepairType.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(63) > 0)
                    {
                        tNode1 = new TreeNode("预警统计", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(63) > 0)
                        {
                            tNode2 = new TreeNode("预警统计", "", "", "YJTJ.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(63) > 0)
                        {
                            tNode2 = new TreeNode("按维修周期", "", "", "YJTJBasedONWXZQ.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(63) > 0)
                        {
                            tNode2 = new TreeNode("按备件审批周期", "", "", "YJTJBasedOnBJSQ.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(63) > 0)
                        {
                            tNode2 = new TreeNode("按返厂维修周期", "", "", "YJTJBasedOnFC.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(63) > 0)
                        {
                            tNode2 = new TreeNode("按报价确认周期", "", "", "YJTJBasedOnBaoJia.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(64) > 0)
                    {
                        tNode1 = new TreeNode("维修记录查询", "", "", "SearchMaintainRecords.aspx", "mainFrame");
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(65) > 0)
                    {
                        tNode1 = new TreeNode("客户满意度统计", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(65) > 0)
                        {
                            tNode2 = new TreeNode("客户满意度统计", "", "", "ClientSatisfaction.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(65) > 0)
                        {
                            tNode2 = new TreeNode("按平台", "", "", "ClientSatisfactionBaseOnServiceStation.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(66) > 0)
                    {
                        tNode1 = new TreeNode("收费统计", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(66) > 0)
                        {
                            tNode2 = new TreeNode("按年按月按平台和区间", "", "", "SFTJBaseOnSeriveStationAndInterval.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(66) > 0)
                        {
                            tNode2 = new TreeNode("按收款条件查询", "", "", "SFTJBaseOnSFTJ.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        if (ContextService.GetPermission(66) > 0)
                        {
                            tNode2 = new TreeNode("按代理商", "", "", "SFTJBaseOnProvider.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(67) > 0)
                    {
                        tNode1 = new TreeNode("维修元件统计", "", "", "", "mainFrame");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(67) > 0)
                        {
                            tNode2 = new TreeNode("按年按月按平台消耗统计", "", "", "AccessoryTJ.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(67) > 0)
                    {
                        tNode1 = new TreeNode("指标统计", "", "", "", "mainFrame");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;

                        tNode2 = new TreeNode("0-5天TAT", "", "", "ZBTJ0T5TAT.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);

                        tNode2 = new TreeNode("0-3天TAT", "", "", "ZBTJ0T3TAT.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);

                        //tNode2 = new TreeNode(">5天TAT", "", "", "ZBTJL5TAT.aspx", "mainFrame");
                        //tNode1.ChildNodes.Add(tNode2);

                        tNode2 = new TreeNode("二次返修率", "", "", "ZBTJSecondRepairRate.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);                        

                        tNode2 = new TreeNode("完修率", "", "", "ZBTJWXL.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);

                        tNode2 = new TreeNode("供应商周期", "", "", "ZBTJFactoryZQ.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);

                        tNode2 = new TreeNode("平台升级率", "", "", "ZBTJPlatformUpgradeRate.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);

                        tNode2 = new TreeNode("当月DOA数", "", "", "ZBTJDOA.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);

                        tNode2 = new TreeNode("当月RMA数", "", "", "ZBTJRMA.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);

                        tNode2 = new TreeNode("备件满足率", "", "", "ZBTJBJStatisfy.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);

                        tNode2 = new TreeNode("备件先行满足率", "", "", "ZBTJBJXXStatisfy.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);

                        tNode2 = new TreeNode("备件清理率", "", "", "ZBTJBJQL.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);

                        tNode.ChildNodes.Add(tNode1);
                    }
                }

                if (ContextService.HasSubPermission(9) > 0)
                {
                    tNode = new TreeNode("签字权限流程管理", "", "", "", "");
                    tNode.SelectAction = TreeNodeSelectAction.Expand;
                    tNode.Expanded = false;
                    menuTreeView.Nodes.Add(tNode);

                    if (ContextService.GetPermission(84) > 0 ||
                    ContextService.GetPermission(85) > 0 ||
                    ContextService.GetPermission(86) > 0 ||
                    ContextService.GetPermission(87) > 0 ||
                    ContextService.GetPermission(88) > 0 ||
                    ContextService.GetPermission(89) > 0)
                    {
                        tNode1 = new TreeNode("特服申请签字流程", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        if (ContextService.GetPermission(89) > 0)
                        {
                            tNode2 = new TreeNode("所有特服申请单", "", "", "TFSQList.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(84) > 0)
                        {
                            tNode2 = new TreeNode("定义申请表", "", "", "TFSQDefineList.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(85) > 0)
                        {
                            tNode2 = new TreeNode("填写申请表", "", "", "TFSQFillList.aspx", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(86) > 0)
                        {
                            tNode2 = new TreeNode("初审人签字", "", "", string.Format("TFSQSignList.aspx?{0}={1}", Constants.QUERYSTR_STATUS, 3), "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(87) > 0)
                        {
                            tNode2 = new TreeNode("终审人签字", "", "", string.Format("TFSQSignList.aspx?{0}={1}", Constants.QUERYSTR_STATUS, 4), "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(88) > 0)
                        {
                            tNode2 = new TreeNode("加签人签字", "", "", string.Format("TFSQSignList.aspx?{0}={1}", Constants.QUERYSTR_STATUS, 5), "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(90) > 0 ||
                        ContextService.GetPermission(91) > 0 ||
                        ContextService.GetPermission(92) > 0 ||
                        ContextService.GetPermission(93) > 0)
                    {
                        tNode1 = new TreeNode("备件转储签字流程-工厂间", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;

                        if (ContextService.GetPermission(93) > 0)
                        {
                            tNode2 = new TreeNode("所有申请表", "", "", "ZCAllList.aspx?Type=1", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(90) > 0)
                        {
                            tNode2 = new TreeNode("填写申请表", "", "", "ZCFillForm.aspx?Type=1", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(91) > 0)
                        {
                            tNode2 = new TreeNode("审批申请表", "", "", "ZCSignList.aspx?Type=1", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        //if (ContextService.GetPermission(92) > 0)
                        //{
                        //    tNode2 = new TreeNode("已驳回申请表", "", "", "", "");
                        //    tNode1.ChildNodes.Add(tNode2);
                        //}

                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(94) > 0 ||
                        ContextService.GetPermission(95) > 0 ||
                        ContextService.GetPermission(96) > 0 ||
                        ContextService.GetPermission(97) > 0)
                    {
                        tNode1 = new TreeNode("备件转储签字流程-同工厂", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;

                        if (ContextService.GetPermission(94) > 0)
                        {
                            tNode2 = new TreeNode("所有申请表", "", "", "ZCAllList.aspx?Type=2", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(95) > 0)
                        {
                            tNode2 = new TreeNode("填写申请表", "", "", "ZCFillForm.aspx?Type=2", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        if (ContextService.GetPermission(96) > 0)
                        {
                            tNode2 = new TreeNode("审批申请表", "", "", "ZCSignList.aspx?Type=1", "mainFrame");
                            tNode1.ChildNodes.Add(tNode2);
                        }

                        //if (ContextService.GetPermission(97) > 0)
                        //{
                        //    tNode2 = new TreeNode("已驳回申请表", "", "", "", "");
                        //    tNode1.ChildNodes.Add(tNode2);
                        //}

                        tNode.ChildNodes.Add(tNode1);
                    }
                }

                if (ContextService.HasSubPermission(8) > 0)
                {
                    tNode = new TreeNode("基础信息", "", "", "", "");
                    tNode.SelectAction = TreeNodeSelectAction.Expand;
                    tNode.Expanded = false;
                    menuTreeView.Nodes.Add(tNode);

                    if (ContextService.GetPermission(68) > 0)
                    {
                        tNode1 = new TreeNode("角色权限管理", "", "", "", "");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        tNode2 = new TreeNode("新建角色", "", "", "AddRole.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                        tNode2 = new TreeNode("角色权限管理", "", "", "ManageRole.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(69) > 0)
                    {
                        tNode1 = new TreeNode("配置菜单维护管理", "", "", "", "mainFrame");
                        tNode1.SelectAction = TreeNodeSelectAction.Expand;
                        tNode2 = new TreeNode("平台管理", "", "", "ManageServiceStation.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                        tNode2 = new TreeNode("产品版本号管理", "", "", "ManageProductVersion.aspx", "mainFrame");
                        tNode1.ChildNodes.Add(tNode2);
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(70) > 0)
                    {
                        tNode1 = new TreeNode("系统特殊设置管理", "", "", "SpecialSetting.aspx", "mainFrame");
                        tNode.ChildNodes.Add(tNode1);
                    }
                }

                if (ContextService.HasSubPermission(10) > 0)
                {
                    tNode = new TreeNode("导出信息", "", "", "", "");
                    tNode.SelectAction = TreeNodeSelectAction.Expand;
                    tNode.Expanded = false;
                    menuTreeView.Nodes.Add(tNode);

                    if (ContextService.GetPermission(102) > 0)
                    {
                        tNode1 = new TreeNode("导出维修流程信息", "", "", "ExportMaintainRecords.aspx", "mainFrame");
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(103) > 0)
                    {
                        tNode1 = new TreeNode("导出返厂备件升级信息", "", "", "ExportSRUForms.aspx", "mainFrame");
                        tNode.ChildNodes.Add(tNode1);
                    }

                    if (ContextService.GetPermission(104) > 0)
                    {
                        tNode1 = new TreeNode("导出基础信息", "", "", "ExportBasicInformation.aspx", "mainFrame");
                        tNode.ChildNodes.Add(tNode1);

                        tNode1 = new TreeNode("导出任务信息", "", "", "RWGLExport.aspx", "mainFrame");
                        tNode.ChildNodes.Add(tNode1);
                    }
                }

            }
        }
    }
}
